package org.u2ml.stack.xml;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * A XmlStreamer allow to stream objects to XML, and convert XML stream to Java
 * objects.
 */
public interface XmlStreamer {
	/**
	 * Indicates if a type is streamable by this {@link XmlStreamer}.
	 * 
	 * @param type
	 *            the type to test, must not be <code>null</code>
	 * @return <code>true</code> if the given type is streamable,
	 *         <code>false</code> otherwise
	 */
	public boolean isStreamable(Class<?> type);
	
	public <T> T fromXML(InputStream stream, Class<T> clazz);
	
	public <T> T fromXML(String string, Class<T> clazz);
	
	public String toXML(Object obj);
	
	public void toXML(Object obj, OutputStream stream);

	public void registerLocalConverter(Object converter, String name);
}
